/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = frct_comm.h                                        */
/*  NOTE      = conntrack公用                                      */
/*  DATE      = 2014/10/28                                         */
/*******************************************************************/

#ifndef __FRCT_COMM_H_
#define __FRCT_COMM_H_

#include "frcomm.h"
#include "frmem.h"
#include "frlist.h"
#include "conntrack.h"
#include "module.h"

#define FR_DIRECT_UNKNOWN        0x00      /* 该连接ip+端口 不能确定 */
#define FR_DIRECT_KNOWN          0x01      /* 该连接ip+端口 确定 */
#define FR_DIRECT_SRV2CLIENT     0x02      /* 该连接服务器->客户端 */
#define FR_DIRECT_CLIENT2SRV     0x03      /* 该连接客户端->服务器 */

#define FR_SRV_IP_PORT           0x04      /* 该连接ip+端口 服务端 */
#define FR_CLIENT_IP_PORT        0x05      /* 该连接ip+端口 客户端 */

L7_transaction *frct_get_L7transaction(Conntrack *p_st_ct);

L7_session *frct_get_session(Conntrack *p_st_ct);

char *frct_get_session_username(L7_session *p_st_session);
int  frct_set_session_username(L7_session *p_st_session, const char *p_username);
void frct_free_session_username(L7_session *p_st_session);

struct timeval *frct_get_session_starttime(L7_session *p_st_session);
int frct_set_session_starttime(L7_session *p_st_session, struct timeval *p_st_starttime);

struct timeval *frct_get_session_stoptime(L7_session *p_st_session);
int frct_set_session_stoptime(L7_session *p_st_session, struct timeval *p_st_stoptime);

void *frct_get_session_private(L7_session *p_st_session);
int frct_set_session_private(L7_session *p_st_session, void *p_session_private);

int *frct_get_session_status(L7_session *p_st_session);
int frct_set_session_status(L7_session *p_st_session, int i_status);

void frct_free_l7_session(L7_module *p_st_l7_module, L7_session *p_st_l7_session);
void frct_free_l7_transaction(L7_transaction *p_st_l7_transaction);

int frcap_get_cs_direction(Conntrack *p_st_ct, u_int ui_ip, u_short us_port);
int frcap_set_cs_srv(Conntrack *p_st_ct, u_int ui_ip, u_short us_port);

L7_analyzer *frproto_l7_get_analyzer(Conntrack *p_st_ct);

#endif
